package com.wn.cloud.common.response;

import com.wn.cloud.common.constant.ResponseEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @FileName: ListCommonResult
 * @Description: TODO
 * @Author: MaWenHao
 * @Created: 2020/3/8 - 1:33
 * @Version: V1.0
 * @Company: 东方微银科技（北京）有限公司
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ListResult<T> extends CommonResult {

    private long total;

    private T data;

    public static <V> ListResult<V> genDataResult(ResponseEnum responseEnum, long total, V data) {
        ListResult<V> listResult = new ListResult<>(total, data);
        listResult.setCode(responseEnum.getCode());
        listResult.setMessage(responseEnum.getMessage());
        return listResult;
    }

}
